# import requests
# from lxml import etree
#
# url = 'https://www.gying.org/ac'
#
# headers = {
#     'cookie':'PHPSESSID=s21h11a70i70gf592dp75mb14r; BT_auth=4e65T9LvaiUvd1uD3861ga12chtBAEBocSxWGBfY8GY3GqM5QxQ2y0_r_QU56vAVs0Dp8046SO7IySt3b0DKWMWUPgG9HEesx6KgDUbBkzWeeFplkkI_YA55NJK6wQHUCmQdHTrOoMMOajoaKrGb_mmN2DXnf1GaK0AFxgl8i2dI; BT_cookietime=07fa0Zeu7nB3j8YVBq77msb6ftN5WhM9oiwQxKkySDfMs3Z9O8t-',
#     'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
# }
#
# response = requests.get(url, headers=headers)
# # print(response.status_code)
# # print(response.text)
#
# tree = etree.HTML(response.text)
# datas = tree.xpath('//scrip')
# # print(datas)
# for data in datas:
#     print(data.xpath('.//_obj.inlist'))
import re
import json
import requests

session = requests.Session()

login_url = 'https://www.gying.org/user/login/'

session.post(login_url, data={
    'siteid':1,
    'dosubmit':1,
    'cookietime':10506240,
    'username':'ykq',
    'password':'Ykq123456'
})

res = session.get('https://www.gying.org/user/favorite')

data = re.search(r'_obj.inlist=(.*);', res.text)
if data:
    data = data.group(1)
    data = json.loads(data)
    title = data['t']
    img = data['i']

    for i,t in enumerate(title):
        print(t, f'https://s.tutu.pm/img/mv/{img[i]}/384.avif')